package com.deyuanyun.pic.settings.controller.dto.prvlg;

import com.deyuanyun.pic.settings.domain.prvlg.Role;

/**
 * 权限模块 “角色” 新建或编辑对象
 *
 * 方法详情：<br/>
 *
 * @author huanglw
 * @date  2016-11-24
 *
 * History: [修改人][时间][修改描述]
 */
public class RoleEdit extends SettingsBaseEdit<Role> {

    // 角色名称
    private String name;
    // 角色编号
    private String code;
    // 是否启用：0，启用；1，关闭；
    private Short state;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public Short getState() {
        return state;
    }

    public void setState(Short state) {
        this.state = state;
    }

    @Override
    public void fromDomain(Role domain) {

        // 角色名称
        this.name = domain.getName();
        // 角色编号
        this.code = domain.getCode();
        // 状态
        this.state = domain.getState();

        super.fromDomain(domain.getId(), domain.getCreateRemark());
    }

    @Override
    public Role toDomain() {
        Role role = new Role();
        role.setId(this.getId());
        role.setCreateRemark(this.getRemark());
        role.setName(this.getName());
        role.setCode(this.getCode());
        return role;
    }
}